﻿#pragma once


#include "Containers/String.h"
#include "Math/IntPoint.h" 
#include "Math/MathBase.h"

#include <iostream>
#include <iomanip>



#include <freetype/freetype.h>
#include <freetype/ftglyph.h>

#include "Framework/Application.h"
#include "Path/Paths.h"
#include "Font/FontSubsystem.h"
#include "Font/Glyph.h"
#include "Widgets/WindowManager.h"
#include "Widgets/ImageWidget.h"
#include "Widgets/TextWidget.h"

int main(int argc, char* argv[])
 {
  auto App=NewObject<RApplication>();

  SApplicationArgument Arguments;
  Arguments.ExecutablePath=argv[0];
  Arguments.DefaultFont=Arguments.ExecutablePath.Parent()/U"Content"/U"EngineEditor"/U"Fonts"/U"SourceHanSansHWSC-Bold.otf";
  App->Initialize(Arguments);
  
  auto FontSubsystem=App->GetSubsystem<RFontApplicationSubsystem>();

  char32_t Text[]={U'重',U'脚',U'猫'};
  auto Glyph=FontSubsystem->GetDefaultFont()->FindOrCreateGlyph(Text[0],12); 
  auto Image=Glyph->LoadTexture();

  auto Window=NewObject<RWindow>();
  Window->Show();

  auto Widget1=NewWidget<RImageWidget>(Window->GetRootWidget());
  Widget1->Image=Image;
  Widget1->Width=Image->GetWidth();
  Widget1->Height=Image->GetHeight();

  auto Widget=NewWidget<RImageWidget>(Window->GetRootWidget());
  Widget->Image=Image;
  Widget->Y=Image->GetHeight()+10;
  Widget->Width=Image->GetWidth()*10;
  Widget->Height=Image->GetHeight()*10;

  // auto TextWidget=NewWidget<RTextWidget>(Window);
  // TextWidget->Text=(Text);
  // TextWidget->SetFont(TestFont);
  // TextWidget->Anchor.TopReference=Widget;
  // TextWidget->Anchor.TopReferenceEdge=EVerticalWidgetEdge::Bottom;


  App->Run();   
}